package cn.tac.framework.core.exception;

import cn.tac.framework.core.pojo.ErrorCode;
import cn.tac.framework.core.pojo.ErrorMessage;

import java.util.HashMap;

/**
 * 全局通用异常 - range[1,99]
 *
 * @author : tac
 * @since : 2017/5/18
 */
public enum GenericErrorCode implements ErrorCode {
    INVALID_REQUEST_ARGUMENT("1"),

    ;

    private static HashMap<ErrorCode, String> zh = new HashMap<>();
    static {
        zh.put(GenericErrorCode.INVALID_REQUEST_ARGUMENT, "无效请求参数：%s");
    }
    private static ErrorMessage errorMessage = new ErrorMessage(zh);

    private String code;
    GenericErrorCode(String code) {
        this.code = code;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMessage(Object... args) {
        return errorMessage.getErrorMessage(this, args);
    }
}
